package com.saxion.dao.mocks;

import java.util.ArrayList;
import java.util.List;

import com.saxion.dao.ProductDao;
import com.saxion.model.Product;

public class ProductDaoMock implements ProductDao {
	private ArrayList<Product> producten = new ArrayList<Product>();

	@Override
	public Product getProductById(int id) {
		for(Product p : producten){
			if(p.getProductCode() == id){
				return p;
			}
		}
		return null;
	}

	@Override
	public List<Product> getProductBySoort(String soort) {
		ArrayList<Product> tempProducten = new ArrayList<Product>();
		for(Product p : producten){
			if(p.getProductSoort().equalsIgnoreCase(soort)){
				tempProducten.add(p);
			}
		}
		return tempProducten;
	}

	@Override
	public Product addProduct(Product p) {
		producten.add(p);
		return p;

	}

}
